import type {
    Audio,
    ComfyModel,
    JYAnimation,
    JYEffect,
    JYTransition,
    Role,
    Scene, TTSChannel,
    TweetData,
    VoiceModel
} from "~/utils/jiangying";
import {BackgroundMusics, StyleAndModels, VoiceModels, workEditData} from "~/data/ai/workeditdata";
import type {TTSOptions} from "~/composables/VoiceHooks";
export type  ApiSource='sd3'|'default'

export const useWorkEditStore = defineStore({
    id: "workEdit",
    state: () => ({
        init_active: false,
        ckpt_id: 0,
        // 用户配置参数
        animations: [] as JYAnimation[],
        effects: [] as JYEffect[],
        transitions: [] as JYTransition[],
        models: StyleAndModels as ComfyModel[],
        voiceModels: VoiceModels as VoiceModel[],
        roles: workEditData.roles as Role[],
        scenes: workEditData.scenes as Scene[],
        ttsChannel:'ChatTTS' as TTSChannel,   //TTS渠道
        //项目参数
        projectName: "",
        localProjectPath: useGlobalConfig.jiangying.localProjectPath,
        Resolution_id: 0,
        cover_url: "",
        full_contents: "",   //文本
        narrator_voice_id: 0,  //旁白声音id
        useVideo: true, //使用视频合成
        backgroundMusic_id: 0, //背景音乐
        contents: workEditData.contents || [{
            content: "",
            prompts: "",
            images: [],
            choose_image_index: 0,
            audio: [],
            role: "",
            scene_id: 0,
            video: "",
            transition: '',
            video_effect: '',
            animation: ''
        }] as TweetData[],
        //本地绘画设置，不需要保存到项目的部分
        apisource: "default" as ApiSource,
        useLocalVits:false,
        localVitsUrl:"http://127.0.0.1:5000",
        useLocalChatTTS:false,
        localChatttsUrl:"http://127.0.0.1:9966"

    }),

    persist:
        [{
            storage: persistedState.localStorage,
            // paths: ['projectName', 'roles', 'Resolution_id', 'cover_url', 'contents', 'models', 'animations', 'effects', 'transitions', 'voiceModels','useVideo']
        }],

    getters: {},
    actions: {},
});
